package cn.broadin.app.hotel.component;

import android.content.Context;
import android.text.TextUtils;

import com.alibaba.fastjson.JSONObject;

public class ComponentFacotry {

    public static final String VIEW_LIVE = "live";

    public static final String VIEW_TIMEPICKER = "timePicker";

    public static final String VIEW_CARD = "card";

    public static BaseView createView(Context context, JSONObject item){
        String type = item.getString("type");
        if(TextUtils.isEmpty(type)){
            return null;
        }
        BaseView baseView = null;
        switch(type){
            case VIEW_LIVE:
                baseView = LiveView.newInstance(context, item);
                break;
            case VIEW_TIMEPICKER:
                baseView = TimePickerView.newInstance(context, item);
                break;
            case VIEW_CARD:
                baseView = CardView.newInstance(context, item);
                break;
        }
        return baseView;
    }
}
